package server

import (
	"github.com/go-kratos/kratos/v2/transport/http"
	"github.com/gorilla/mux"
	"go_private_im/internal/comet/conf"
	"go_private_im/internal/comet/service"
)

func NewWebsocket(conf *conf.Config, service *service.WsHandlerService) *http.Server {

	router := mux.NewRouter()

	router.HandleFunc("/sub", service.Handler)

	httpSrv := http.NewServer(http.Address(conf.Websocket.Port))

	httpSrv.HandlePrefix("/", router)

	return httpSrv
}
